package common;

/**
 * @author alex
 * Shared class containing all of the enumerated types that will be used by the
 * system.
 */
public class Enums
{
    /**
     * @author alex
     * The state of the protocol
     */
    public enum ProtocolState
    {
        /**
         * The initial state of the protocol.
         */
        INITIAL,
        /**
         * The state during which authentication takes place.
         */
        AUTHENTICATION,
        /**
         * That state where the client and server have successfully established
         * a connection.
         */
        CONNECTED,
        /**
         * The state where a client is ready to send a message to another client
         * through the server.
         */
        COMPOSITION,
        /**
         * The state where a logout has been initiated.
         */
        LOGOUT,
    }

    /**
     * @author alex
     * The type of message.
     */
    public enum MessageType
    {
        /**
         * Not a real message type. Indicates an error.
         */
        NULL,
        /**
         * Sent by a client to proceed to the authentication state.
         */
        JOIN,
        /**
         * Sent by a server after it accepts a JOIN to progress to the connected
         * state.
         */
        AUTHENTICATE,
        /**
         * Sent by the client to complete the authentication state and progress
         * to the connected state.
         */
        LOGIN,
        /**
         * Sent by the client to exit whatever state currently in use and
         * proceed to the logout state, with intent to close the connection.
         */
        LOGOUT,
        /**
         * Sent by the client to proceed from connected state to composition
         * state.
         */
        SEND,
        /**
         * Sent by the client to proceed from composition state back to
         * connected state.
         */
        DATA,
        /**
         * Sent by the client to proceed from composition state back to
         * connected state.
         */
        CANCEL,
        /**
         * The server sends this command to the recipient client when it reads a
         * message off the server’s transmission message queue.
         */
        INCOMING,
        /**
         * The client sends this command to request a list of users.
         */
        LIST,
        /**
         * The server sends this command any time it wants to check the client
         * for timeout, and can be used in any state other than initial and
         * logout.
         */
        ALIVE,
        /**
         * The server sends this command any time it cannot deliver a message to
         * a recipient after it has already accepted the message.
         */
        FAILED
    }
}